﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack stack = new Stack();
            //向栈中存放元素
            stack.Push("张三");
            stack.Push("李四");
            stack.Push("王五");
            Console.WriteLine("查看李四有没有上车！");
            if (stack.Contains("李四"))//查看栈中有没有指定元素
            {
                Console.WriteLine("在车上！");
            }
            else
            {
                Console.WriteLine("不在车上！");

            }
            Console.WriteLine("车辆到站/n开始下车：");
            //判断栈中是否有元素
            while (stack.Count != 0)
            {
                //取出栈中的元素
                Console.WriteLine(stack.Pop());
            }
            Console.WriteLine("下车完毕！");

            
           

        }
    }
}
